home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Database Designers / Rational Rose 2000 / Rational Setup.EXE / common / lib / Win32 / Process.pm < prev    next >
Text File  |  1998-11-15  |  3KB  |  146 lines

  1. package Win32::Process;
  2.  
  3. require Exporter;
  4. require DynaLoader;
  5. @ISA = qw(Exporter DynaLoader);
  6.  
  7. $VERSION = '0.04';
  8.  
  9. # Items to export into callers namespace by default. Note: do not export
  10. # names by default without a very good reason. Use EXPORT_OK instead.
  11. # Do not simply export all your public functions/methods/constants.
  12. @EXPORT = qw(
  13.     CREATE_DEFAULT_ERROR_MODE
  14.     CREATE_NEW_CONSOLE
  15.     CREATE_NEW_PROCESS_GROUP
  16.     CREATE_NO_WINDOW
  17.     CREATE_SEPARATE_WOW_VDM
  18.     CREATE_SUSPENDED
  19.     CREATE_UNICODE_ENVIRONMENT
  20.     DEBUG_ONLY_THIS_PROCESS
  21.     DEBUG_PROCESS
  22.     DETACHED_PROCESS
  23.     HIGH_PRIORITY_CLASS
  24.     IDLE_PRIORITY_CLASS
  25.     INFINITE
  26.     NORMAL_PRIORITY_CLASS
  27.     REALTIME_PRIORITY_CLASS
  28.     THREAD_PRIORITY_ABOVE_NORMAL
  29.     THREAD_PRIORITY_BELOW_NORMAL
  30.     THREAD_PRIORITY_ERROR_RETURN
  31.     THREAD_PRIORITY_HIGHEST
  32.     THREAD_PRIORITY_IDLE
  33.     THREAD_PRIORITY_LOWEST
  34.     THREAD_PRIORITY_NORMAL
  35.     THREAD_PRIORITY_TIME_CRITICAL
  36. );
  37.  
  38. sub AUTOLOAD {
  39.     # This AUTOLOAD is used to 'autoload' constants from the constant()
  40.     # XS function.
  41.     my($constname);
  42.     ($constname = $AUTOLOAD) =~ s/.*:://;
  43.     my $val = constant($constname);
  44.     if ($! != 0) {
  45.         my ($pack,$file,$line) = caller;
  46.         die "Your vendor has not defined Win32::Process macro $constname, used at $file line $line.";
  47.     }
  48.     eval "sub $AUTOLOAD { $val }";
  49.     goto &$AUTOLOAD;
  50. } # end AUTOLOAD
  51.  
  52. bootstrap Win32::Process;
  53.  
  54. 1;
  55. __END__
  56.  
  57. =head1 NAME
  58.  
  59. Win32::Process - Create and manipulate processes.
  60.  
  61. =head1 SYNOPSIS
  62.     use Win32::Process;
  63.     use Win32;
  64.  
  65.     sub ErrorReport{
  66.         print Win32::FormatMessage( Win32::GetLastError() );
  67.     }
  68.  
  69.     Win32::Process::Create($ProcessObj,
  70.                 "D:\\winnt35\\system32\\notepad.exe",
  71.                 "notepad temp.txt",
  72.                 0,
  73.                 NORMAL_PRIORITY_CLASS,
  74.                 ".")|| die ErrorReport();
  75.  
  76.     $ProcessObj->Suspend();
  77.     $ProcessObj->Resume();
  78.     $ProcessObj->Wait(INFINITE);
  79.  
  80. =head1  DESCRIPTION
  81.  
  82. This module allows for control of processes in Perl.
  83.  
  84. =head1 METHODS
  85.  
  86. =over 8
  87.  
  88. =item Win32::Process::Create($obj,$appname,$cmdline,$iflags,$cflags,$curdir)
  89.  
  90. Creates a new process.
  91.  
  92.     Args:
  93.  
  94.     $obj        container for process object
  95.     $appname    full path name of executable module
  96.     $cmdline    command line args
  97.     $iflags        flag: inherit calling processes handles or not
  98.     $cflags        flags for creation (see exported vars below)
  99.     $curdir        working dir of new process
  100.  
  101. =item $ProcessObj->Suspend()
  102.  
  103. Suspend the process associated with the $ProcessObj.
  104.  
  105. =item $ProcessObj->Resume()
  106.  
  107. Resume a suspended process.
  108.  
  109. =item $ProcessObj->Kill( $ExitCode )
  110.  
  111. Kill the associated process, have it die with exit code $ExitCode.
  112.  
  113. =item $ProcessObj->GetPriorityClass($class)
  114.  
  115. Get the priority class of the process.
  116.  
  117. =item $ProcessObj->SetPriorityClass( $class )
  118.  
  119. Set the priority class of the process (see exported values below for
  120. options).
  121.  
  122. =item $ProcessObj->GetProcessAffinitymask( $processAffinityMask, $systemAffinitymask)
  123.  
  124. Get the process affinity mask.  This is a bitvector in which each bit
  125. represents the processors that a process is allowed to run on.
  126.  
  127. =item $ProcessObj->SetProcessAffinitymask( $processAffinityMask )
  128.  
  129. Set the process affinity mask.  Only available on Windows NT.
  130.  
  131. =item $ProcessObj->GetExitCode( $ExitCode )
  132.  
  133. Retrieve the exitcode of the process.
  134.  
  135. =item $ProcessObj->Wait($Timeout)
  136.  
  137. Wait for the process to die. forever = INFINITE
  138.  
  139. =back
  140.  
  141. =cut
  142.  
  143. # Local Variables:
  144. # tmtrack-file-task: "Win32::Process"
  145. # End:
  146.